﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Windows.Controls;

namespace FXSStation.CustomControls.LineChart
{
    public class DataCollection
    {
        private ObservableCollection<DataSeries> _dataList;

        public ObservableCollection<DataSeries> DataList
        {
            get { return _dataList; }
            set { _dataList = value; }
        }

        public DataCollection()
        {
            _dataList = new ObservableCollection<DataSeries>();
        }

        public void AddLines(Canvas canvas, ChartStyle cs)
        {
            int j = 0;
            foreach (DataSeries ds in DataList)
            {
                if (ds.SeriesName == "Default Name")
                {
                    ds.SeriesName = "DataSeries" +
                        j.ToString();
                }
                ds.AddLinePattern();
                for (int i = 0; i <
                    ds.LineSeries.Points.Count; i++)
                {
                    ds.LineSeries.Points[i] =
                        cs.NormalizePoint(
                        ds.LineSeries.Points[i]);
                }
                canvas.Children.Add(ds.LineSeries);
                j++;
            }
        }

        
    }
}
